<%@ include file="/WEB-INF/common/taglibs.jsp"%>
<script type="text/javascript"
	src="${ctx}/resources/js/datatable-query.js"></script>


<script>
	$(document)
			.ready(
					function() {

						<c:if test="${entity.id ne null}">

						<c:forEach  var="attributeFilterConfig" items="${entity.attributeFilterConfigs}">
						<c:forEach items="${attributeFilterConfig.attributes}" var="attribute">
						$("input[name='attributeIds'][value=${attribute.id}]")
								.attr('checked', 'checked').uniform();
						</c:forEach>
						</c:forEach>

						<c:forEach  var="optionFilterConfig" items="${entity.optionFilterConfigs}">
						<c:forEach items="${optionFilterConfig.optionValue}" var="optionVal">
						$("input[name='optionValueIds'][value=${optionVal.id}]")
								.attr('checked', 'checked').uniform();
						</c:forEach>
						</c:forEach>

						<c:forEach  var="manufacturer" items="${entity.manufacturers}">
						$(
								"input[name='manufacturerIds'][value=${manufacturer.id}]")
								.attr('checked', 'checked').uniform();
						</c:forEach>

						</c:if>

					});
</script>
<div class="row-fluid">

	<div class="span12">

		<div class="page-header">
			<h4>Shop Filter Config</h4>
		</div>

		<form class="form-horizontal seperator" method="post">
			<!--name -->
			<div class="form-row row-fluid">
				<div class="span12">
					<div class="row-fluid">
						<label class="form-label span3" for="name">Name :</label><input
							class="span4" id="name" name="name" type="text"
							value="${entity.name}" />
					</div>
				</div>
			</div>
			<!--code -->
			<div class="form-row row-fluid">
				<div class="span12">
					<div class="row-fluid">
						<label class="form-label span3" for="code">Code :</label><input
							class="span4" id="code" name="code" type="text"
							value="${entity.code}" />
					</div>
				</div>
			</div>
			<!--priceSlider -->
			<div class="form-row row-fluid">
				<div class="span12">
					<div class="row-fluid">
						<label class="form-label span3" for="priceSlider">PriceSlider
							:</label>
						<div class="left marginT5 marginR10">
							<div class="radio" id="uniform-priceSlider1">
								<span class="<c:if test="${entity.priceSlider }">checked</c:if>"><input
									type="radio" name="priceSlider" id="priceSlider1" value="true"
									<c:if test="${entity.priceSlider}">checked="checked"</c:if>
									style="opacity: 0;"></span>
							</div>
							True
						</div>
						<div class="left marginT5 marginR10">
							<div class="radio" id="uniform-priceSlider2">
								<span class="<c:if test="${!entity.priceSlider}">checked</c:if>"><input
									type="radio"
									<c:if test="${!entity.priceSlider}">checked="checked"</c:if>
									name="priceSlider" id="priceSlider2" value="false"
									style="opacity: 0;"></span>
							</div>
							False
						</div>
					</div>
				</div>
			</div>
			<!--category -->
			<div class="form-row row-fluid">
				<div class="span12">
					<div class="row-fluid">
						<label class="form-label span3">Category :</label>
						<div class="span4 controls">
							<select name="categoryId">
							<option value="-1" > ======</option>
							<c:if
									test="${not empty categories}">
									<c:forEach var="single" items="${categories}">
										<option value="${single.id}"
											${(single.id == entity.category.id)?'selected':'' }>${single.name}</option>
									</c:forEach>
								</c:if></select>
						</div>
					</div>
				</div>
			</div>
			<!--manufacturer -->
			<div class="form-row row-fluid">
				<div class="span12">
					<div class="row-fluid">
						<label class="form-label span3" for="manufacturer">Manufacturer
							:</label>
						<div class="left marginT5 marginR10">
							<div class="radio" id="uniform-manufacturer1">
								<span
									class="<c:if test="${entity.manufacturer }">checked</c:if>"><input
									type="radio" name="manufacturer" id="manufacturer1"
									value="true"
									<c:if test="${entity.manufacturer}">checked="checked"</c:if>
									style="opacity: 0;"></span>
							</div>
							True
						</div>
						<div class="left marginT5 marginR10">
							<div class="radio" id="uniform-manufacturer2">
								<span
									class="<c:if test="${!entity.manufacturer}">checked</c:if>"><input
									type="radio"
									<c:if test="${!entity.manufacturer}">checked="checked"</c:if>
									name="manufacturer" id="manufacturer2" value="false"
									style="opacity: 0;"></span>
							</div>
							False
						</div>
					</div>
				</div>
			</div>
		
		<c:set var="row" value="0"/>
		

	
		
		
				<c:forEach items="${options}" var="option">
						<c:set var="row" value="${row + 1}"/>
		
				<c:if test="${row % 2 == 1 }">	<div class="row-fluid"> </c:if>
				
					<div class="span6">
						<div class="todo">
							<h4>${option.name}
								Option <a href="#" class="icon tip" title=""> </a>
							</h4>
							<ul>
								<c:forEach items="${option.optionValues}" var="optionValue">

									<li class="clearfix">
										<div class="txt">${optionValue.name}</div>
										<div class="controls">
											<input name="optionValueIds" type="checkbox"
												value="${optionValue.id}">
										</div>
									</li>

								</c:forEach>

							</ul>
						</div>
					</div>
					<c:if test="${row % 2 == 0 }"> xxx	</div> </c:if>

				</c:forEach>




				<c:forEach items="${attributeGroups}" var="attributeGroup">
				<c:set var="row" value="${row + 1}"/>
					<c:if test="${row % 2 == 1 }">	<div class="row-fluid"> </c:if>
					<div class="span6">
						<div class="todo">
							<h4>${attributeGroup.name}
								Attribute Group <a href="#" class="icon tip" title=""></a>
							</h4>
							<ul>

								<c:forEach items="${attributeGroup.attributes}" var="attribute">
									<li class="clearfix">
										<div class="txt">${attribute.name}</div>
										<div class="controls">
											<input name="attributeIds" type="checkbox"
												value="${attribute.id}">
										</div>
									</li>
								</c:forEach>
							</ul>
						</div>
					</div>
				<c:if test="${row % 2 == 0 }"> </div> </c:if>

				</c:forEach>
				<c:set var="row" value="${row + 1}"/>
				<c:if test="${row % 2 == 1 }">	<div class="row-fluid"> </c:if>
				<div class="span6">
					<div class="todo">
						<h4>
							Manufacturer <a href="#" class="icon tip" title=""></a>
						</h4>
						<ul>

							<c:forEach items="${manufacturers}" var="entity">
								<li class="clearfix">
									<div class="txt">${entity.name}</div>
									<div class="controls">
										<input name="manufacturerIds" type="checkbox"
											value="${entity.id}">
									</div>
								</li>
							</c:forEach>
						</ul>
					</div>
				</div>

			</div>





			<div class="form-row row-fluid">
				<div class="span12">
					<div class="row-fluid">
						<div class="form-actions">
							<div class="span3"></div>
							<div class="span4 controls">
								<button type="submit" class="btn btn-info marginR10">Save
									changes</button>
								<button class="btn btn-danger">Cancel</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</form>

	</div>
	<!-- End .span12 -->

</div>
<!-- End .row-fluid -->

